package com.wbp.cms.qatest.dao;

import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import org.junit.Test;
import com.wbp.cms.client.product.domain.ProductDO;
import com.wbp.cms.client.product.query.ProductQuery;
import com.wbp.cms.core.product.dao.ProductDAO;
import com.wbp.cms.qatest.BaseTest;


/**
 * @Description: 
 * @Department:
 * @author andy.lhc
 * @date 2016年3月10日 下午8:29:12 
 */
public class ProductDAOTest extends BaseTest {

  @Resource
  private ProductDAO  productDAO ;
  
  
  @Test
  public void  test_新增001(){
  
    ProductDO p =new ProductDO();
    
    p.setName("信托00001");
    p.setSequenceCode(UUID.randomUUID().toString());
    p.setImage("http://1111111111");
    p.setProductType(1);
    p.setBigSmallProportion(2); 
    p.setCollectAccount("lihc-test");
    p.setCreator("root");
    p.setIsHot(1);
    p.setRatio( 5.6d );
    System.out.println( productDAO.insert(p) > 0 )  ;
    
  }
  
  @Test
  public void  test_新增002(){
  
    ProductDO p =new ProductDO();
    
    p.setName("信托00002");
    p.setSequenceCode(UUID.randomUUID().toString());
    p.setImage("http://2222222222");
    p.setProductType(2);
    p.setBigSmallProportion(1); 
    p.setCollectAccount("lihc-test");
    p.setCreator("root");
    p.setIsHot(0);
    p.setRatio( 66.6d );
    p.setProfitType(3);
    System.out.println( productDAO.insert(p) > 0 )  ;
    
  } 
  
  @Test
  public void test_更新(){
    
    ProductDO p = this.productDAO.load(1L) ;
    p.setProjectTerm(5); 
    p.setName("信托00001---00000"); 
    p.setInvestType(5);
    p.setStatus(3);
    p.setTag(2); 
    p.setIsHot(0);
    System.out.println( this.productDAO.update(p) > 0 ) ;
  }
  
  
  @Test
  public void test_query(){
    ProductQuery  productQuery =new ProductQuery();
    List<ProductDO> list = productDAO.query(productQuery)  ;
    System.out.println("size: "+list.size()) ;
  }
  
  
  
}
